import 'package:flutter/material.dart';
import 'package:flutter_boss_mine/pages/find_page.dart';
import 'package:flutter_boss_mine/pages/mine_page.dart';
import 'package:flutter_boss_mine/pages/position_page.dart';
import 'package:flutter_boss_mine/pages/temp_page.dart';
import 'package:flutter_boss_mine/utils/color_util.dart';
import 'package:flutter_boss_mine/utils/lottie_tabbar_item.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:lottie/lottie.dart';

class MainPage extends StatefulWidget {
  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  var _controller = PageController(initialPage: 0);
  int _currentIndex = 0;

  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context,designSize: Size(750, 1334), allowFontScaling: false);
    return Scaffold(
        body: PageView(
          controller: _controller,
          children: <Widget>[PositionPage(), FindPage(), TempPage(), MinePage(),],
          physics: NeverScrollableScrollPhysics(),
        ),
        bottomNavigationBar: BottomNavigationBar(
          currentIndex: _currentIndex,
          onTap: (index) {
            _controller.jumpToPage(index);
            setState(() {
              _currentIndex = index;
            });
          },
          selectedFontSize: 12,
          unselectedFontSize: 12,
          selectedItemColor: ColorUtil.color("#23ACA8"),
          type: BottomNavigationBarType.fixed,
          items: [
            BottomNavigationBarItem(
              icon: LottieTabbarItemNormal("lottie_position"),
              activeIcon: LottieTabbarItemSelected("dark_lottie_position"),
              title: Text("职位"),
            ),
            BottomNavigationBarItem(
              icon: LottieTabbarItemNormal("lottie_discover"),
              activeIcon: LottieTabbarItemSelected("dark_lottie_get"),
              title: Text("发现"),//dark_lottie_get
            ),
            BottomNavigationBarItem(
              icon: LottieTabbarItemNormal("lottie_information"),
              activeIcon: LottieTabbarItemSelected("dark_lottie_information"),
              title: Text("消息"),
            ),
            BottomNavigationBarItem(
              icon: LottieTabbarItemNormal("lottie_me"),
              activeIcon: LottieTabbarItemSelected("dark_lottie_me"),
              title: Text("我的"),
            )
          ],
        )
    );
  }
}
